﻿using DataModels.Entities.AuthCore;
using DataModels.Enums.House;

namespace DataModels.Dto.House
{
    public class HouseInfoDto
    {
        public Guid HouseId { get; set; }

        public Guid ProjectId { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 楼栋号
        /// </summary>
        public string BuildingNo { get; set; }

        /// <summary>
        /// 单元号
        /// </summary>
        public string UnitNo { get; set; }

        /// <summary>
        /// 楼层号
        /// </summary>
        public string FloorNo { get; set; }

        /// <summary>
        /// 房号
        /// </summary>
        public string RoomNo { get; set; }

        /// <summary>
        /// 关系
        /// </summary>
        public HousingUserRelationType RelationType { get; set; }

        /// <summary>
        /// 用途
        /// </summary>
        public UsageType UsageType { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 全地址
        /// </summary>
        public string FullAddress
        {
            get
            {
                var parts = new List<string>();

                if (!string.IsNullOrEmpty(BuildingNo))
                    parts.Add($"{BuildingNo}栋");

                if (!string.IsNullOrEmpty(UnitNo))
                    parts.Add($"{UnitNo}单元");

                if (!string.IsNullOrEmpty(FloorNo))
                    parts.Add($"{FloorNo}层");

                if (!string.IsNullOrEmpty(RoomNo))
                    parts.Add($"{RoomNo}室");

                return string.Join("", parts);
            }
        }
    }

    public class HouseInfoResponse : HouseInfoDto
    {
        public new string RelationType { get; set; }
        public new string UsageType { get; set; }
    }


    public class EditHouseInfo
    {
        public Guid ProjectUUID { get; set; }
        public Guid HouseUUID { get; set; }
        public string OwnerTenantName { get; set; }
        public string OwnerTenantPhone { get; set; }
        public string ApplicantName { get; set; }
    }

    public class GetHouseUserDto
    {
        public Guid UserID { get; set; }
        public string UserName { get; set; }

        public string AvatarUrl { get; set; }
        public DateTime? EndDate { get; set; }

        public HousingUserRelationType RelationType { get; set; }

        public string Phone { get; set; }
    }

    public class GetHouseUserResponse : GetHouseUserDto
    {
        public new string RelationType { get; set; }
        public new string CustType { get; set; }
        public new string CustTypeName { get; set; }
    }

    public class HouseCertificationInfo
    {
        public Guid ProjectUUID { get; set; }
        public string HouseUUID { get; set; }

        public string ParkingUUID { get; set; }

        /// <summary>
        /// 资源类型,必填 0-项目,1-房屋,3-车位,
        /// </summary>
        public int RelType { get; set; }

        public string ApplicantName { get; set; }

        /// <summary>
        /// 1 业主，2 业主成员 3租户，4租户成员
        /// </summary>
        public HousingUserRelationType RelationType { get; set; }
        public List<string> Urls { get; set; } = new List<string>();
    }

    public class HouseCertificationOwnerInvitesMembersInfo : HouseCertificationInfo
    {
        public string ApplicantPhone { get; set; }
    }

}
